﻿@model Digital.Contact.Models.TempColumnModel
@using Digital.Common.Mvc.Extensions
@{
    ViewBag.Title = "Column";
    Layout = "~/Views/Shared/_LayoutDigital.cshtml";
}



<div class="row">

    <div class="col-md-12">



        <div class="widget">
            <div class="widget-head">
                <div class="pull-left">Quick Posts</div>
                <div class="clearfix"></div>
            </div>
            <div class="widget-content">
                <div class="padd">
                    <div class="form quick-post">
                        @using (Html.BeginForm("Column", "Template", FormMethod.Post, new { @class = "form-horizontal" }))
                        {
                            @Html.AntiForgeryToken()



                            @Html.ValidationSummary(true)
                            @Html.HiddenFor(model => model.Id)
    <input value="@ViewBag.TempId" type="hidden" name="TemplateID" />
                            <div class="form-group">
                                <label class="control-label col-lg-3" for="title">@Html.DisplayNameFor(model => model.IsPrimaryKey)</label>
                                <div class="col-md-9">
                                    <div class="make-switch" data-on="primary" data-off="info">
                                        <input type="checkbox" @Html.IsChecked(Model.IsPrimaryKey) name="IsPrimaryKey">
                                    </div>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="control-label col-lg-3" for="title">@Html.DisplayNameFor(model => model.ColumnDisplayName)</label>
                                <div class="col-md-9">
                                    @Html.TextBoxFor(model => model.ColumnDisplayName, new { @class = "form-control", Id = "ColumnDisplayName" })
                                    @Html.ValidationMessageFor(model => model.ColumnDisplayName, null, new { @class = "help-inline" })

                                </div>
                            </div>

                            <div class="form-group">
                                <label class="control-label col-lg-3" for="title">@Html.DisplayNameFor(model => model.ColumnName)</label>
                                <div class="col-md-9">
                                    @Html.TextBoxFor(model => model.ColumnName, new { @class = "form-control", Id = "ColumnName" })
                                    @Html.ValidationMessageFor(model => model.ColumnName, null, new { @class = "help-inline" })

                                </div>
                            </div>

                            <div class="form-group">
                                <label class="control-label col-lg-3" for="title">@Html.DisplayNameFor(model => model.Type)</label>
                                <div class="col-md-9">
                                    @Html.TextBoxFor(model => model.Type, new { @class = "form-control", Id = "Type" })
                                    @Html.ValidationMessageFor(model => model.Type, null, new { @class = "help-inline" })

                                </div>
                            </div>

                            <div class="form-group">
                                <label class="control-label col-lg-3" for="title">@Html.DisplayNameFor(model => model.ColumnLength)</label>
                                <div class="col-md-9">
                                    @Html.TextBoxFor(model => model.ColumnLength, new { @class = "form-control", Id = "ColumnLength" })
                                    @Html.ValidationMessageFor(model => model.ColumnLength, null, new { @class = "help-inline" })

                                </div>
                            </div>

                            <div class="form-group">
                                <label class="control-label col-lg-3" for="title">@Html.DisplayNameFor(model => model.IsMultiSelected)</label>
                                <div class="col-md-9">
                                    <div class="make-switch" data-on="primary" data-off="info">
                                        <input type="checkbox" @Html.IsChecked(Model.IsMultiSelected) name="IsMultiSelected">
                                    </div>

                                </div>
                            </div>

                            <div class="form-group">
                                <label class="control-label col-lg-3" for="title">@Html.DisplayNameFor(model => model.IsOnlyOneCheck)</label>
                                <div class="col-md-9">
                                    <div class="make-switch" data-on="primary" data-off="info">
                                        <input type="checkbox" id="IsRelationCheck" onclick="IsRelation()" @Html.IsChecked(Model.IsOnlyOneCheck) name="IsMultiSelected">
                                    </div>

                                </div>
                            </div>
                            
                                <div class="form-group @Html.ShowClass(Model.IsOnlyOneCheck)" id="IsRelationgroup" >
                                    <label class="control-label col-lg-3" for="title">@Html.DisplayNameFor(model => model.IsRelation)</label>
                                    <div class="col-md-9">
                                        <button type="button" onclick="javascript:window.location.href='../Template/ColumnList'" class="btn btn-primary">字段编辑</button>

                                    </div>
                                </div>
                            
                            <div class="form-group">
                                <!-- Buttons -->
                                <div class="col-lg-offset-2 col-lg-9">
                                    <button type="submit" class="btn btn-danger">保 存</button>
                                </div>
                            </div>



                        }
                    </div>
                </div>
                <div class="widget-foot">
                    <!-- Footer goes here -->
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    function IsRelation()
    {
        if ($("#IsCheck").is(':checked')) {
            $("#IsRelationgroup").show();
        }
        else {
            $("#IsRelationgroup").hide();
        }
    }
</script>
